package com.xc.quickstart.infrastructure.mq;

import com.aliyun.openservices.ons.api.bean.ProducerBean;
import com.xc.quickstart.common.properties.MqProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MqProducerConfig {

    @Autowired
    private MqProperties mqProperties;

    @Bean(initMethod = "start", destroyMethod = "shutdown")
    public ProducerBean buildProducer() {
        ProducerBean producer = new ProducerBean();
        producer.setProperties(mqProperties.getMqProperties());
        return producer;
    }

}
